#!/bin/bash

jar cvf paxos_test.jar src lib hosts.dat init.sh build.xml log_configuration.dat init_ec2.sh hosts_ec2.dat deploy_ec2.sh ec2_hosts_privateips.dat ec2_hosts_publicips.dat ssh_cmd.dat

for ip in `cat ec2_hosts_publicips.dat`
do
    ssh -i ~/.ec2/iloveapple.pem bitnami@$ip "mkdir ~/paxos; rm -fr ~/paxos/*"
    scp -i ~/.ec2/iloveapple.pem paxos_test.jar bitnami@$ip:~/paxos/
    ssh -i ~/.ec2/iloveapple.pem bitnami@$ip "cd ~/paxos; jar xvf paxos_test.jar; ant build; chmod +x init_ec2.sh"
done